<v-box title="博客列表">
    <v-tab ref="tableList">
        <v-row>
            <v-col span="10">
                <v-form ref="queryForm" ajax_url="/admin/model"></v-form>
            </v-col>
            <v-col span="2">
                <button class="layui-btn" @click="query"><i class="fa fa-search"></i> 查询</button>
            </v-col>
        </v-row>
        <v-tab-pane label="已发布">
            <v-table ajax_url="/admin/blog/list?status=2" ref="postList2" :operations="operations"></v-table>
        </v-tab-pane>
        <v-tab-pane label="草稿">
            <v-table ajax_url="/admin/blog/list?status=1" ref="postList" :operations="operations"></v-table>
        </v-tab-pane>
        <v-tab-pane label="回收站">
            <v-table ajax_url="/admin/blog/list?status=0" ref="postList1" :operations="operations"></v-table>

        </v-tab-pane>

    </v-tab>
</v-box>

<script>
    new Vue({
        el:"#app" ,
        data: {
            render: {
                myIcon: function (row, $table) {
                    return '<i class="' + row.myIcon + '"></i>'
                }
            },
            operations : [
                {
                    name : '编辑' ,
                    class: 'btn-success',
                    icon:'edit',
                    method : function(row , $table) {
                        window.location.href = "/index.html/#/admin/admin_edit.html"+"?id="+row.uid;
                    }
                } ,
                {
                    name : '删除'  ,
                    class: 'btn-danger',
                    icon:'trash',
                    method : function(row ,$table) {
                        axios.get('/admin/delete/'+row.uid).then(function (response) {
                            $.alert(response.data);
                            $table.fetchData()
                        });

                    }
                }
            ]
        } ,
        methods: {
            query: function (event) {
                debugger;
                this.$refs.postList.refresh(this.$refs.queryForm)
            },
            re_query : function () {
                this.send_req++
            }
        } ,
    });

</script>
